package ani.trainning.cacobatph.situation;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import ani.trainning.cacobatph.R;

public class AdapterDacPeriode extends BaseAdapter {

	List<String>periodes=new ArrayList<String>();
	LayoutInflater layoutInflater;

	public AdapterDacPeriode(Context context,List<String>periodes){
		this.layoutInflater=LayoutInflater.from(context);
		this.periodes=periodes;

	}
	@Override
	public int getCount() {
		return this.periodes.size();
	}

	@Override
	public Object getItem(int arg0) {
		return this.periodes.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}
	public static  class Holder {
		TextView textPeriode;


	}

	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		Holder holder;
		if(convertView==null){
			convertView=layoutInflater.inflate(R.layout.itemlistdacs, null);
			holder=new Holder();
			holder.textPeriode=(TextView) convertView.findViewById(R.id.textDacPeriode);
			convertView.setTag(holder);
		}
		else{
			holder=(Holder) convertView.getTag();

		}
		holder.textPeriode.setText(periodes.get(position));
		return convertView;
	}

}
